#pragma warning(disable:4996)
#include<stdio.h>
int main()
{
	size_t N;
	int t;
	scanf("%u", &N);
	t = N * 420 / 14;
	printf("%d", 8 * t % 420);
	return 0;
}